home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
include
/
dvfds.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
7KB
|
222 lines
/*
| file name -- dvfds.h
|===================================================================
|
| copyright (c) 1989-91, V.I. Corporation
|
| dvfds.h -- Includes useful in function Data source modules
|
| alan c morse 24 apr 89 initial release
|
| charlie hileman 12 dec 90 expanded function types
| charlie hileman 15 jan 91 added structure for optional args
| alan morse 15 mar 91 modified macro to make more portable
| Len Bertelli 28 sep 94 changed V_FDS_FCN_WRITE comments
|
|===================================================================
|
| include-file description/function:
| This contains defines, macros, and data structures
| for use in modules that implement function data sources.
|
|===================================================================
*/
#ifndef V_DVFDS_INCLUDED
#define V_DVFDS_INCLUDED
#include "std.h"
#include "dvstd.h"
#include "VOstd.h"
/* function used when V_FDS_DESC or V_FDS_FCN_DESC is missing */
#define V_FDS_DEFAULT_NAME Mdefaultfdsfcn
LONG V_FDS_DEFAULT_NAME();
/* limit for default function arguments */
#define V_FDS_MAX_ARGS 10
/* defines using the types below - start, end, and max of types */
#define V_FDS_FCN_START V_FDS_FCN_DS_START
#define V_FDS_FCN_END V_FDS_FCN_DSV_END
#define V_FDS_FCN_MAX_TYPES V_FDS_FCN_DSV_END
/* Function types for a function descriptor set -
These enums are used to directly reference function tables. They are
split up into two groups: DS and DSV function types. Unused enums are
added before the DS and DSV ends, allowing new types to be easily
added and tested (replace unused enum with new type for testing,
add back unused enum when checking the file in).
To add a new type and have its function arguments saved and
restored, you must edit "Mfdsutils.c" and add the type to the
fixed-index table. If deleting a type, you may also have to edit
this table (see the comments in the file).
*/
typedef enum
{
/* *** Function types for data sources *** */
V_FDS_FCN_DS_START = 0,
/* mandatory functions for all FDSets */
V_FDS_FCN_OPEN,
V_FDS_FCN_READ,
V_FDS_FCN_CLOSE,
/* optional create, destroy, save, and restore functions */
V_FDS_FCN_DS_CREATE,
V_FDS_FCN_DS_DESTROY,
V_FDS_FCN_DS_SAVE,
V_FDS_FCN_DS_RESTORE,
V_FDS_FCN_WRITE,
/* --> place all new DATA SOURCE types ABOVE this line <-- */
V_FDS_FCN_DS_X1, V_FDS_FCN_DS_X2, V_FDS_FCN_DS_X3,
V_FDS_FCN_DS_END,
/* *** Function types for ds VARIABLES *** */
V_FDS_FCN_DSV_START,
/* mandatory functions for all FDSets */
V_FDS_FCN_SELECT,
/* optional create and destroy functions */
V_FDS_FCN_DSV_CREATE,
V_FDS_FCN_DSV_DESTROY,
/* write out selectively*/
V_FDS_FCN_SELECT_WRITE,
/* --> place all new ds VARIABLE types ABOVE this line <-- */
V_FDS_FCN_DSV_X1, V_FDS_FCN_DSV_X2, V_FDS_FCN_DSV_X3,
V_FDS_FCN_DSV_END
} V_FDS_FCN_ENUM;
/* argument value types */
typedef enum
{
V_FDS_ARG_LONG,
V_FDS_ARG_DOUBLE,
V_FDS_ARG_TEXT,
V_FDS_ARG_DSV
} V_FDS_ARG_ENUM;
/* argument block to declare default args - union cannot be casted */
typedef struct
{
char *name;
V_FDS_ARG_ENUM type;
LONG l_val;
double d_val;
char *t_val;
} V_FDS_ARG_DECL;
/* argument block used to pass optional args to functions */
typedef struct
{
int type; /* V_NULL_TYPE, V_T_TYPE, V_L_TYPE, V_D_TYPE or V_DSV_TYPE */
ANYTYPE value; /* union holds all possible values */
} V_FDS_OPT_ARG;
/* structure used to declare a FDSet function */
typedef struct
{
V_FDS_FCN_ENUM fcn_type; /* type of function */
ADDRESS (*fcn)(); /* function pointer */
char *fcn_desc; /* function description */
V_FDS_ARG_DECL def_args[V_FDS_MAX_ARGS]; /* default arguments */
} V_FDS_FCN_DESC;
/* complete FDSet structure: a null-terminated array of V_FDS_FCN_DESC's */
typedef V_FDS_FCN_DESC *(V_FDS_TABLE[]);
/* type used to pass FDSets around */
typedef V_FDS_FCN_DESC **V_FDS_DESC;
/* defines to declare arguments */
#define V_FDS_LONG_ARG_DECL( name, value ) { name, V_FDS_ARG_LONG, value },
#define V_FDS_DOUBLE_ARG_DECL( name, value ) { name, V_FDS_ARG_DOUBLE,0,value},
#define V_FDS_TEXT_ARG_DECL( name, value ) {name,V_FDS_ARG_TEXT,0,0.0,value},
#define V_FDS_DSVAR_ARG_DECL( name ) { name, V_FDS_ARG_DSV },
/* generic define for declaring all FDSet functions */
/* Needs to be fully bracketed, with at least one entry */
/* (null entry at the end) to be portable. */
#define V_FDS_FCN_DECL( fcn_type, desc_name, fcn, fcn_desc ) \
LOCAL V_FDS_FCN_DESC desc_name = \
{ \
fcn_type, (ADDRESS (*)())fcn, (char *)fcn_desc, \
{
#define V_FDS_END_FCN_DECL \
{ (char*)0, 0 } /* Need at least one entry */ \
} \
};
/* used to add defined function declarations to FDset */
#define V_FDS_FCN_DEFINED( descname ) &descname,
#define V_FDS_NULL_DECL(name) \
V_FDS_DESC name V_P_( (void) ); \
V_FDS_DESC name() { return (V_FDS_DESC)NULL; }
#define V_FDS_START_DECL(name) \
V_FDS_DESC name V_P_( (void) ); \
LOCAL V_FDS_DESC query_fds_table V_P_( (void) ); \
\
V_FDS_DESC name() { return query_fds_table(); } \
\
LOCAL V_FDS_TABLE L_fdstable = \
{
#define V_FDS_END_DECL \
(V_FDS_FCN_DESC*)NULL \
}; \
\
LOCAL V_FDS_DESC query_fds_table() { return L_fdstable; }
/* ==================================================================
The defines below are for pre-9.0 compatibility. If compiling a
Function Descriptor Set with pre-9.0 defines, set "V_8TO9_COMPATIBILITY"
before including this file */
#ifdef V_8TO9_COMPATIBILITY
#define LONG_ARG_DECL V_FDS_LONG_ARG_DECL
#define DOUBLE_ARG_DECL V_FDS_DOUBLE_ARG_DECL
#define TEXT_ARG_DECL V_FDS_TEXT_ARG_DECL
#define DSVAR_ARG_DECL V_FDS_DSVAR_ARG_DECL
#define INIT_FCN_DECL( dscname, fcn, name ) \
V_FDS_FCN_DECL( V_FDS_FCN_OPEN, dscname, fcn, name )
#define READ_FCN_DECL( dscname, fcn, name ) \
V_FDS_FCN_DECL( V_FDS_FCN_READ, dscname, fcn, name )
#define TERM_FCN_DECL( dscname, fcn, name ) \
V_FDS_FCN_DECL( V_FDS_FCN_CLOSE, dscname, fcn, name )
#define SELECT_FCN_DECL( dscname, fcn, name ) \
V_FDS_FCN_DECL( V_FDS_FCN_SELECT, dscname, fcn, name )
#define FCN_DECL V_FDS_FCN_DEFINED
#define END_FCN_DECL V_FDS_END_FCN_DECL
#define START_FDS_DECL V_FDS_START_DECL
#define END_FDS_DECL V_FDS_END_DECL
#endif /* V_8TO9_COMPATIBILITY */
#endif /* V_DVFDS_INCLUDED */